<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>我的发布</title>
<link rel="stylesheet" href="https://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="https://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<style>
.myTitleImg{

	background-image:url("image/ipad.jpg");
	background-repeat:no-repeat;
	background-size:100% 100%;
	height:320px;
	
}
h1 a:hover{

	text-decoration:underline;

}

</style>
<script>
function GetRequest() {
    var url = location.search; //获取url中"?"符后的字串
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
        }
    }
    return theRequest;
}

var a=GetRequest();
var index_1=a['id'];
var j = {"newsauthod":index_1};
$.ajax({
	type : "post",
	url : "<c:url value='/NewsServlet?method=newsSelectName'/>",            //servlet需要提前在web.xml里面注册
	dataType : "json",
	data :j,
	success : function(data,textStatus)
	{
        //data为后端post函数传递来的数据，这里写结果操作代码
		var objs = eval(data);  //解析json对象
		if(objs[0]==''){                                                     //解决用户没上传问题
			$("#2").hide();
			$("#2").parent().hide();
			$("#tips").text("您的发布空空如也！！请联系管理员13189679384 为您开店");
			
		}
		else{
		$("#2").before("<img src="+objs[0].newsimg+" alt='图片加载失败'>");
		$("#2_title").text(objs[0].newstitle);
		$("#2_content").text(objs[0].newscontent);
		$("#2_authod").text(objs[0].newsauthod);
		$("#2_tell").text("Tel:"+objs[0].tell);

		}
		$("#newsauthod").attr("value",objs[0].newsauthod);
		if(objs[0].newsid!='')
		{
			$("#newsid").attr("value",objs[0].newsid);
			$("#newsid_s").attr("value",objs[0].newsid);
			$("#upload").attr("href","./upload.jsp?newsid="+objs[0].newsid)
			if(objs[0].newsimg=='')
			{
				$("#tips_2").text("请点击下面的上传按钮，完善您的商品信息");
				$("#submits").hide();
				$("#2").hide();
				$("#2").parent().hide();
			}else
				if($("#info_success").val()!='')
				$("#tips_2").text("恭喜：上传成功");
		}
		
	},
	error : function(xhr, status, errMsg)
	{
		alert("数据加载失败!");
	}
});



</script>
<body >



			<div class="container" >
			
			
				<div class=" myTitleImg text-center">
					<div style="position:relative ;top:60%">
						<h1 ><a href="index.jsp" style="color:#ffffff;">信科买卖 </a> </h1>
						<h1 style="color:#ffffff;">————*———— </h1>
					</div>
				</div>
			<div>
			<h4 id="tips" style="color: #800000;">${error }</h4>          <!-- 反馈信息 -->
			<h4 id="tips_2" style="color: gold;">${f  }</h4>
			</div>	              													

			
		
				
			<!-- 表单 -->
			<hr/>
			<h3>您的商品发布信息</h3>
			<form class="form-horizontal" action="<c:url value='/userDelete?method=post'/>" method="post">
				<div class="form-group form-group-lg has-info">
					<div class="input-group col-md-6  col-sm-9">
						<div class="input-group-addon "
							style="background: #339933; color: white">
							<span class="glyphicon glyphicon-user "> 您的昵称</span>       									<!-- 姓名id="newsauthod" -->
						</div>
						<input id="newsauthod" class="form-control" type="text"    value='' disabled>

					</div>

				</div>


				<div class="form-group form-group-lg has-info">
					<div class="input-group col-md-6  col-sm-9">
						<div class="input-group-addon "
							style="background: #339933; color: white">
							<span class="glyphicon glyphicon-lock "> 您的摊位</span>
						</div>
						<input id="newsid"  class="form-control"  type="text" value='' disabled  >
						<input id="newsid_s" class="form-control" name="newsid" type="text" value='' style="display:none" >				<!-- 商品位置 id="newsid"-->
					</div>
				</div>

				<div class="form-group ">
					<div class="input-group col-md-9  col-sm-9 col-xs-12">
						
							<div class="col-md-6 col-xs-10 col-sm-8 ">
								<button type="submit" id="submits"
									class="btn btn-warning btn-block btn-lg"
									style="text-shadow: black 5px 3px 3px;">
									<span class="glyphicon glyphicon-hand-right"></span> 我要下架
								</button>
							</div>
							
						
					</div>
				</div>
			
			</form>
	</div>
		<div class=" container text-center">
			
		<div class="col-md-4 col-sm-6 col-xs-12">
			<div class="row">
				<div class="thumbnail">

					<!-- 这里会自动插入img标签 -->
					<div id="2" class="caption">

						<h4 id="2_title" style="color: #CC6600"></h4>
						<h5 id="2_content"></h5>

						<button class="btn btn-info" id="2_authod">用户名</button>
						<button class="btn btn-success">联系方式</button>
						<h6 id="2_tell"></h6>

					</div>
				</div>
				
				<div>
					
					<a  id="upload"  href="" class="btn btn-lg btn-info btn-block" target="_top">我要修改/上传</a>

				</div>
			</div>
			</div>
			
		</div>
<input type="text" id="info_success" value="${info_success }" style="display:none">
</body>
</html>